﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JAsyncServerLib.Test
{
    class Program
    {
        static void Main(string[] args)
        {
            JServer server = new JServer<JClient>();
            server.OnConnect += new JServer.OnConnectDelegate(server_OnConnect);
            server.Listen(1234);
            server.Start();
            Console.WriteLine("Listening on port 1234...");

            Console.ReadLine();
            Console.WriteLine("Stopping server...");
            server.Stop(false);
            Console.WriteLine("Server shut down complete!\r\nPress enter to quit!");
            Console.ReadLine();
        }

        static void server_OnConnect(JClient session)
        {
            Console.WriteLine("Connection from : " + session.GetRemoteIP());
        }
    }
}
